<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,height=device-height,viewport-fit=cover,initial-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">
	<meta name="format-detection" content="telephone=no,email=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="description" content="还卡超人">
	<meta name="keywords" content="还卡超人,拍拍贷">
	<title>正在跳转</title>
</head>
<body>
	跳转中..
	<script>
		var getURLParam = function (key) {
			return (new RegExp('\\?(?:.+(?:&|=))?' + key + '=([^&#]*)(?:&|#|$)').exec(location.search) || [])[1] || null;
		};
		var isiOS = navigator.userAgent.match('iPad')
			|| navigator.userAgent.match('iPhone')
			|| navigator.userAgent.match('iPod');
		// 声明ready事件
		var evt = new Event('WebViewJavascriptBridgeReady');
		// WebViewJavascriptBridgeReady
		document.addEventListener('WebViewJavascriptBridgeReady', function () {
			var status = getURLParam('status'),
				serial = getURLParam('serial');
			if (status !== '1' && status !== '2' && status !== '3' || serial === null) {
				return alert('跳转失败！');
			}
			try {
				WebViewJavascriptBridge.callHandler('rechargeWithdrawCallback', {
					'code': +!(status - 1),
					'name': '资管充值提现后续流程',
					'data': {
						'typeCode': 1,
						'typeMessage': '充值',
						'statusCode': status,
						'statusMessage': [
							'成功',
							'失败',
							'异常'
						][status - 1],
						'serialNo': serial
					}
				});
			} catch(ex) {
				try {
					AppBridge.rechargeWithdrawCallback(JSON.stringify({
						'code': +!(status - 1),
						'name': '资管充值提现后续流程',
						'data': {
							'typeCode': 1,
							'typeMessage': '充值',
							'statusCode': status,
							'statusMessage': [
								'成功',
								'失败',
								'异常'
							][status - 1],
							'serialNo': serial
						}
					}));
				} catch (ex) {
					alert('跳转失败');
					throw ex;
				}
			}
		}, false);
		// 注册WebViewJavascriptBridge
		var injectWebViewJavascriptBridge = function (callback) {
			if (window.WebViewJavascriptBridge) {
				return callback();
			}
			// ios
			if (window.WVJBCallbacks) {
				return window.WVJBCallbacks.push(callback);
			}
			window.WVJBCallbacks = [callback];
			var WVJBIframe = document.createElement('iframe');
			WVJBIframe.src = 'wvjbscheme://__BRIDGE_LOADED__';
			WVJBIframe.style.display = 'none';
			document.body.appendChild(WVJBIframe);
			setTimeout(function () {
				document.body.removeChild(WVJBIframe);
				// ios appbridge
				if (!window.WebViewJavascriptBridge) {
					callback();
				}
			}, 0);
		};
		// 注册WebViewJavascriptBridge回调
		var injectWebViewJavascriptBridgeCallback = function () {
			document.dispatchEvent(evt);
		};
		// init
		if (isiOS) {
			injectWebViewJavascriptBridge(injectWebViewJavascriptBridgeCallback);
		}
	</script>
</body>
</html>
